/*
 * Copyright (c) Extreme Vision Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef LICENSE_PERSON_DET_H
#define LICENSE_PERSON_DET_H

#include <map>
#include <mutex>
#include "opencv2/core.hpp"
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>

#include "evdeploy/core/ev_common_data.h"
#include "evdeploy/core/ev_deploy.h"
#include "evdeploy/cv/common/common.h"
#include "evdeploy/cv/detection/yolox_prepostprocessor.h"
#include "evdeploy/utils/json/json.h"

namespace ev
{
    namespace algo
    {

        class PersonDet
        {
        public:
            PersonDet(std::string engine, std::string uuid);

            ~PersonDet();
            /**
             * @brief 行人检测
             * @param[in] input_mat: input image
             * @param[in] thresh: confidence thresh
             * @param[out] persons_bbox: detected persons bbox in ev::vision::BoxInfo format
             * @return EVStatus
             */
            EVStatus Run(cv::Mat &input_mat, std::vector<ev::vision::BoxInfo> &persons_bbox, float thresh);

        private:
            std::string m_uuid;
            std::string m_engine;
            static std::mutex m_mutex;
            ev::vision::YOLOxPreprocessor m_preprocessor;
            ev::vision::YOLOxPostprocessor m_postprocessor;
        };
    } // namespace algo
} // namespace ev

#endif
